package com.yi.wood.room;

import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by moyi on 2018/10/11 17:09
 *
 * @author moyi
 * 战场，这是一个集合类（缓存了所有对战房间）
 */
public class Battlefield<T extends Room> extends ConcurrentHashMap<Integer,Room> {
    private volatile static Battlefield<CoupleRoom> gobBattlefield = new Battlefield<>();

    private Battlefield(){}

    public static Battlefield getGobBattlefield(){
        return gobBattlefield;
    }

    public int getGobSize(){
        return gobBattlefield.size();
    }

    public void gobAddBattle(Room gobCoupleRoom){
        int num = gobCoupleRoom.getNum();
        gobBattlefield.put(num,gobCoupleRoom);
    }

}
